package office.word.documents4j;

import com.documents4j.api.DocumentType;
import com.documents4j.api.IConverter;
import com.documents4j.job.LocalConverter;

import java.io.File;
import java.util.concurrent.TimeUnit;

/**
 * @author zhanglu
 * @project JavaBase
 * @description
 * @date 2023/6/27 11:19
 */
public class Documents4jTest {

    public static void main(String[] args) {
        String source= "/Users/zhanglu/Desktop/tmp/documents4j/source.docx";
        String target = "/Users/zhanglu/Desktop/tmp/documents4j/1.pdf";
        IConverter converter = LocalConverter.builder()
                .workerPool(20, 25, 2, TimeUnit.SECONDS)
                .processTimeout(300, TimeUnit.SECONDS)
                .build();
        boolean execute = converter.convert(new File(source)).as(DocumentType.DOCX).to(new File(target)).as(DocumentType.PDF).execute();
        System.out.println(execute);
    }




}
